var api = require('../../utils/api.js')
var app = getApp()

Page({

    /**
     * 页面的初始数据
     */
    data: {
        imgs:'//img10.360buyimg.com/n1/jfs/t1/245642/19/19201/110355/66ebeeefF250aa107/abca6ddf87c27d07.jpg',
        id:''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.setData({
            id:options.id
        })
        this.getinfos();
    },

    getinfos(){
        var id=this.data.id;
        var that=this;
        api.post({
            url: 'orderlist/getsuqiuinfobyid',
            data: {id:id},
            success: data => {
                console.log(data) 

                that.setData({
                    info:data.data
                })
            }
        })

    },

    pinglu(){
        var that=this;
        var id=this.data.id;
        wx.showActionSheet({
            alertText:'您对处理结果满意吗？',
            itemList: ['满意', '不满意'],
            success (res) {
              console.log(res.tapIndex)
              var index=res.tapIndex;
                
              api.post({
                url: 'orderlist/manyi',
                data: {id:id,index:index},
                success: data => {
                    console.log(data) 
                    that.getinfos();
                }
            })

            },
            fail (res) {
              console.log(res.errMsg)
            }
          })

          
    },
    previewImage(e) {
        var imgs=this.data.info.img_arr;

        wx.previewImage({
            current: imgs[0], // 当前显示图片的http链接
            urls: imgs // 需要预览的图片http链接列表
        });

    },

    previewImages(){
        var imgs=this.data.info.ret_img;
        wx.previewImage({
            current: imgs[0], // 当前显示图片的http链接
            urls: imgs // 需要预览的图片http链接列表
        });
    }
})